package com.gcd.gym.mapper;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gcd.gym.model.Member;
import com.gcd.gym.model.form.CourseOfMember;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface MemberMapper extends BaseMapper<Member> {

    default Page<Member> findMember(Page<Member> page, Member member) {
        LambdaQueryWrapper<Member> wrapper = Wrappers.lambdaQuery(member);
        wrapper.select(Member::getId, Member::getName, Member::getPhone, Member::getCreateTime, Member::getVip);
        return selectPage(page, wrapper);
    }

    int deleteMembersById(Integer  id);

    List<CourseOfMember> searchMembersCourse(Integer memberId, Integer status);
}
